package com.ja.openchat.ui.chat.redpacket;

import android.os.Bundle;

import androidx.appcompat.widget.AppCompatTextView;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import com.google.android.material.tabs.TabLayout;
import com.ja.openchat.BR;
import com.ja.openchat.R;
import com.ja.openchat.ui.message.adapter.SimpleFragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;
import me.goldze.mvvmhabit.base.BaseActivity;

public class RedPacketRecordActivity extends BaseActivity {

    @BindView(R.id.tablayout)
    TabLayout tablayout;
    @BindView(R.id.viewPager)
    ViewPager viewPager;
    @BindView(R.id.tv_bar_title)
    AppCompatTextView tvBarTitle;


    @Override
    public void initView() {
        super.initView();
        tvBarTitle.setText("红包记录");
        List<Fragment> fragments = new ArrayList<>();
        fragments.add(RedPacketRecordFragment.newInstance(1));
        fragments.add(RedPacketRecordFragment.newInstance(2));
        SimpleFragmentPagerAdapter fragmentAdater = new  SimpleFragmentPagerAdapter(getSupportFragmentManager(),fragments,new String[]{"收到的红包","发出的红包"});
        viewPager.setAdapter(fragmentAdater);
        tablayout.setupWithViewPager(viewPager);
    }

    @Override
    public int initContentView(Bundle savedInstanceState) {
        return R.layout.activity_red_packet_record;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @OnClick(R.id.iv_bar_back)
    public void onClick() {
        finish();
    }
}
